Navigation

  • index
  • next |
  • previous |
  • PyHowTo documentation »
  • Basic »
  • Beginner »

Table of Contents

Python v3.7 HowTos:

  • ----------------
  • Recursion
  • Backtracking
  • Dynamic Programming
  • Greedy
  • Sort
  • Binary Search
  • Depth First Search [DFS]
  • Breadth First Search [BFS]
  • Binary Search Tree [BST]
  • ----------------
  • Array
  • String
  • Heap
  • Stack
  • Queue
  • Tree
  • Linked List
  • Hash Table
  • Bit Manipulation
  • Two Pointers
  • Math
  • Decorator
  • ----------------
  • Basic
  • Intermediate
  • Advanced
  • Interview
  • ----------------
  • Spark
  • Tkinter
  • Turtle
  • Games
  • Web
  • ----------------
  • About
  • History

Previous topic

Print the documents of function (__doc__)

Next topic

Print the document

Quick search

Print the calendar of a given month and year¶

Print the calendar of a given month and year. Note: Use ‘calendar’ module.

import calendar

y = int(input("Input the year : "))
m = int(input("Input the month : "))

print(calendar.month(y, m))

Output:

Input the year : 2017
Input the month : 04
     April 2017
Mo Tu We Th Fr Sa Su
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

See also

https://www.w3resource.com/python-exercises/python-basic-exercise-12.php

Navigation

  • index
  • next |
  • previous |
  • PyHowTo documentation »
  • Basic »
  • Beginner »
© Copyright 2020, Sergiy Zaytsev, szaytsev@hotmail.com. Created using Sphinx 2.3.0.